<template>
  <div class="call">
    <!-- 输入框 -->
    <div class="call-too">
      <div class="content-top">
        <div class="top-left" @click="goBack">＜</div>
        <div class="top-right">
          <div @click="goCity">{{ cityName }}&nbsp;∨</div>
          <input type="text" placeholder="想去那里，搜一搜~" />
          <img :src="count[8]" alt="" />
        </div>
      </div>
      <!-- 目的地 -->
      <div class="recommend">目的地推荐</div>
      <!-- 精选 -->
      <div class="choiceness">精选<span>常去好去处</span></div>
      <!-- 图组1 -->
      <div class="imgEs">
        <img v-for="item in countr.imges" :key="item" :src="item" alt="" />
        <div class="ps1">滨海旅居</div>
        <div class="ps2">山川之旅</div>
        <div class="ps3">浪漫金秋</div>
      </div>
      <!-- 圆图 -->
      <div class="circle" v-if="countr.imgUrl">
        <div>
          <p>亲子出游</p>
          <img :src="countr.imgUrl[0]" alt="" />
        </div>
        <div>
          <p>拍照/旅游</p>
          <img :src="countr.imgUrl[1]" alt="" />
        </div>
        <div>
          <p>公司团建</p>
          <img :src="countr.imgUrl[2]" alt="" />
        </div>
        <div>
          <p>徒步登山</p>
          <img :src="countr.imgUrl[3]" alt="" />
        </div>
      </div>
      <footer>附近有13家酒店推荐<span>最近距您1.3km</span></footer>
      <div class="lvyo">全新旅游体验</div>
      <div class="experience">
        <div v-for="item in countr.imgArr" :key="item">
          <img :src="item.img" alt="" />
          <p>{{ item.title }}</p>
        </div>
      </div>
      <van-tabbar v-model="active" :placeholder="true">
        <van-tabbar-item icon="home-o">首页</van-tabbar-item>
        <van-tabbar-item icon="search">游记</van-tabbar-item>
        <van-tabbar-item icon="friends-o">攻略</van-tabbar-item>
        <van-tabbar-item icon="setting-o">我的</van-tabbar-item>
      </van-tabbar>
    </div>
  </div>
</template>

<script>
import { computed, onMounted, watch } from "@vue/runtime-core";
import { useStore } from "vuex";
import { ref } from "vue";
import { useRouter } from "vue-router";
export default {
  setup() {
    const store = useStore();
    const router = useRouter();
    const active = ref(0);
    onMounted(() => {
      store.dispatch("geticon");
      store.dispatch("gettravel");
    });
    const count = computed(() => {
      return store.state.iconlist;
    });
    const countr = computed(() => {
      // console.log(store.state.travellist);
      return store.state.travellist;
    });
    const cityName = computed(() => {
      return store.state.cityName;
    });
    const goCity = () => {
      router.push("/city");
    };
    const goBack = () => {
      router.go(-1);
    };

    watch(count, (o, n) => {
      n;
      // console.log(count);
    });

    watch(countr, (o, n) => {
      n;
      console.log(countr);
    });
    return {
      count,
      active,
      countr,
      goCity,
      cityName,
      goBack,
    };
  },
};
</script>
<style lang="less" scoped>
.call {
  width: 375px;
  height: 100vh;
  background-image: url("http://10.31.165.97:3000/images/%E6%99%AF%E5%8C%BA%E5%9B%BE/%E6%97%85%E6%B8%B81.jpg");
  background-repeat: no-repeat;
  background-size: 100% 35%;

  .call-too {
    width: 100%;
    height: 100%;
    background-image: linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0),
      #f9fbfd 40%
    );

    .content-top {
      display: flex;
      justify-content: space-around;
      .top-left {
        margin-top: 6px;
        color: #fff;
        margin-left: 15px;
        font-size: 27px;
      }
      .top-right {
        border-radius: 10px;
        margin-top: 10px;
        width: 318px;
        height: 27px;
        display: flex;
        background: #fff;
        align-items: center;
        > div {
          border-right: 1px solid #909090;
          padding-right: 10px;
          margin-left: 11px;
          font-size: 14px;
          color: #909090;
        }

        > input {
          height: 100%;
          border: none;
          padding-left: 40px;
        }

        > img {
          position: relative;
          width: 13px;
          height: 13px;
          left: -170px;
          top: 0;
        }
      }
    }
  }

  .recommend {
    margin-top: 25px;
    margin-left: 18px;
    font-size: 15px;
    color: #fff;
  }

  .choiceness {
    margin-top: 8px;
    margin-left: 18px;
    font-size: 11px;
    color: #fff;

    > span {
      margin-left: 20px;
    }
  }

  .imgEs {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: auto;
    margin-top: 10px;
    width: 352px;
    height: 130px;

    > img {
      display: flex;
      width: 110px;
      height: 100px;
      border-radius: 10px;
    }

    > div {
      display: flex;
      justify-content: center;
      align-items: center;
      font-size: 10px;
      width: 100px;
      height: 14px;
      background: #e9e1d8;
      position: absolute;
    }

    .ps1 {
      left: 248px;
      bottom: 30px;
    }
    .ps2 {
      left: 124px;
      bottom: 30px;
    }
    .ps3 {
      left: 4px;
      bottom: 30px;
    }
  }

  .circle {
    // background: #fff;
    display: flex;
    margin: auto;
    width: 352px;
    height: 110px;
    justify-content: space-between;

    > div {
      display: flex;
      flex-direction: column;
      align-items: center;

      > p {
        font-size: 10px;
        margin-bottom: 10px;
      }

      > img {
        border-radius: 50%;
        width: 70px;
        height: 70px;
      }
    }
  }

  footer {
    margin: auto;
    width: 356px;
    height: 30px;
    background: #fff;
    font-size: 10px;
    padding-left: 130px;
    line-height: 30px;

    > span {
      margin-left: 30px;
      color: #909090;
    }
  }

  .lvyo {
    margin-top: 20px;
    margin-left: 18px;
    font-size: 15px;
    font-weight: 900;
    margin-bottom: 10px;
  }

  .experience {
    display: flex;
    width: 100%;
    justify-content: space-around;
    flex-wrap: wrap;

    > div {
      > img {
        width: 170px;
        height: 120px;
        border-radius: 16px;
      }

      > p {
        font-size: 14px;
        font-weight: 900;
        color: #323232;
      }
    }
  }
}
</style>
